package com.kevin.spider.kafka.consumer;

import com.kevin.spider.kafka.constants.KafkaConstants;
import lombok.extern.slf4j.Slf4j;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author admin
 */
@Component
@Slf4j
public class KafkaListenerConsumer {
    @KafkaListener(topics = KafkaConstants.KAFKA_TEST_TOPIC, groupId = KafkaConstants.KAFKA_GROUP_ID)
    public void single(String data) {
        log.info("KAFKA接收到的消息：{}", data);
    }

    @KafkaListener(topics = KafkaConstants.KAFKA_TEST_TOPIC, groupId = KafkaConstants.KAFKA_GROUP_ID)
    public void batch(List<String> data) {
        log.info("KAFKA批量接收到的消息：{}", data);
    }
}
